package Desort;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class SecondIndexReducer extends Reducer<Text,Text,Text,Text> {
    @Override
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
       //{Tom_255,{a.txt 3,b.txt 3,c.txt 3}}
        StringBuilder v  = new StringBuilder();
        //value值的拼接Tom_255  a.txt-->3   b.txt-->3   c.txt-->3
        for(Text value:values){
            v.append(value.toString().replace("\t","-->")+"\t");
        }
        //写出
        context.write(key,new Text(v.toString()));
    }
}
